<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<style>
.easyui-text{
	width: 80px; height: 25px;border-radius:5px;border:thin solid #ddd;
	border-color:#a4e9c1;
}
.easyui-text:focus{
	outline: none;
}
</style>
<script type="text/javascript">
   function generator(){
           var entity=0,service=0,controller=0,add=0,edit=0,list=0,view=0,treegrid=0;
           var tableName=$('#name').val();
           if($('[name=entity]').is(':checked')){
               entity=1;
           }
           if($('[name=entity]').is(':checked')){
               entity=1;
           }
           if($('[name=service]').is(':checked')){
               service=1;
           }
           if($('[name=controller]').is(':checked')){
               controller=1;
           }

           if($('[name=add]').is(':checked')){
               add=1;
           }
           if($('[name=edit]').is(':checked')){
               edit=1;
           }
           if($('[name=list]').is(':checked')){
               list=1;
           }
           if($('[name=view]').is(':checked')){
               view=1;
           }
           if($('[name=treegrid]').is(':checked')){
        	   treegrid=1;
           }
           var data={"tableName":tableName,"entity":entity,"service":service,"controller":controller,
               "add":add,"edit":edit,"list":list,"view":view,"treegrid":treegrid};
           $.ajax({
               url:basePath+'/generator/generator',
               data:data,
               dataType:'json',
               type:'post',
               success:function(result){
                  showMsg('生成代码成功！','success');
                  parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                  parent.$.modalDialog.handler.dialog('close');
               },error:function(error){
                   $.messager.alert('提示','生成代码出错了！','error');
               }
           })
	}
</script>
<div class="easyui-layout" data-options="fit:true,border:false" >
    <div data-options="region:'center',border:false" style="overflow-x:hidden;overflow-y: auto;padding: 3px;" >
         <input type="hidden" id="name" name="tableName" value="${tableName}">
        <table class="grid">
        <tr>
        <td><input type="checkbox" name="entity" value="1"  checked="checked">实体（Entity）</td>
        <td><input type="checkbox" name="service" value="1"  checked="checked" >业务层（Service）</td>
        </tr>
        <tr>
        <td><input type="checkbox" name="controller" value="1"  checked="checked">控制层（Controller）</td>
        <td><input type="checkbox" name="add" value="1"  checked="checked" >前端web层（Add）</td>
        </tr>
        <tr>
        <td><input type="checkbox" name="edit" value="1"  checked="checked">前端web层（Edit）</td>
        <td><input type="checkbox" name="list" value="1"  checked="checked" >前端web层（List））</td>
        </tr>
        <tr>
        <td><input type="checkbox" name="view" value="1"  checked="checked">前端web层（View）</td>
         <td><input type="checkbox" name="treegrid" value="1"  checked="checked">前端web层（Treegrid）</td>
        </tr>
        </table>
   </div>        
</div>